Skip to content

Mockgun: support currency, timecode, uuid, color, password, image and jsonb fields - #466

Open
patrickwolf wants to merge 1 commit into
shotgunsoftware:masterfrom
patrickwolf:mockgun-more-field-types
Open

patrickwolf wants to merge 1 commit into
shotgunsoftware:masterfrom
patrickwolf:mockgun-more-field-types

Conversation

@patrickwolf

Copy link
Copy Markdown

Problem

Writing to a field of type currency, timecode, uuid, color, password, image or jsonb raises

ShotgunError: Field Task.color: Handling for Flow Production Tracking type color is not implemented

Most real sites have such fields, so a schema read from a real site with generate_schema cannot be written to. The schema shipped in tests/mockgun already has color, uuid, password and image fields.

Change

  • _validate_entity_data checks these types against the Python type the server takes: currency an int or a float, timecode an int, jsonb a dict, the others a string (an image field holds a URL).
  • _get_field_type reports them as the type that holds the same values (currency → float, timecode → number, uuid/color/password → text), so filters and order work on them. schema_field_read still reports the real type.

Tests

TestMoreFieldTypes: write and filter a color and an image field, and a wrong Python type is still rejected.

python -m pytest tests/test_mockgun.py

Merge order

Independent of the other Mockgun PRs (default value types, limit and page, upload), but each of them also adds its test class at the end of tests/test_mockgun.py, and "limit and page" also adds a constant next to this one's below the imports of mockgun.py. Whichever is merged later needs a rebase that keeps both sides.

@patrickwolf patrickwolf reopened this Nov 16, 2026
… jsonb fields

Writing to a field of one of these types raised "Handling for Flow Production Tracking type ... is not implemented", so a schema read from a real site could not be written to. They are now validated by the Python type the server takes, and filtered and sorted like the type that holds the same values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant